<section class="content-header">
    <h1>
        {{title}}
        <!-- <small>Control panel</small> -->
    </h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-md-3 col-md-push-9">
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">查询区域</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div class="form-group">
                        <label for="DateTimeRange">时间</label>
                        <input type="text" class="form-control pull-right" id="DateTimeRange" placeholder="请选择日期" />
                    </div>
                    <div class="form-group">
                        <label>区域</label>
                        <dx-drop-down-box #ddda style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [(value)]="subAreaSelected"
                            displayExpr="subArea" placeholder="请选择区域" [showClearButton]="true" (onValueChanged)="onSubAreaSelectedChange($event)"
                            [dataSource]="subAreaItems">
                            <dxo-drop-down-options [height]="340"></dxo-drop-down-options>
                            <div *dxTemplate="let data of 'content'">
                                <button type="button" (click)="clearSubAreaSelected()" class="btn btn-default btn-sm" title="重置">重置</button>&nbsp;&nbsp;&nbsp;
                                <button type="button" (click)="subAreaSelectedOk()" class="btn btn-info btn-sm" title="确定">确定</button>
                                <dx-data-grid [dataSource]="subAreaItems" [hoverStateEnabled]="true" [paging]="{ enabled: true, pageSize: 1000 }" [filterRow]="{ visible: true }"
                                    [(selectedRowKeys)]="subAreaSelected" [scrolling]="{ mode: 'infinite' }" [height]="265" [showColumnLines]="true"
                                    [showRowLines]="true" [showBorders]="true" [rowAlternationEnabled]="true">
                                    <dxo-selection [selectAllMode]="allPages" [showCheckBoxesMode]="always" mode="multiple"></dxo-selection>
                                    <dxi-column dataField="subArea" caption="区域" >
                                    </dxi-column>
                                </dx-data-grid>
                            </div>
                        </dx-drop-down-box>
                    </div>
                    <div class="form-group">
                        <label>工位</label>
                        <dx-drop-down-box #dddb style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [(value)]="equipmentSelected"
                            displayExpr="stationCode" placeholder="请选择工位" [showClearButton]="true" [dataSource]="equipemntItems">
                            <dxo-drop-down-options [height]="340"></dxo-drop-down-options>
                            <div *dxTemplate="let data of 'content'">
                                <button type="button" (click)="clearEquipmentSelected()" class="btn btn-default btn-sm" title="重置">重置</button>&nbsp;&nbsp;&nbsp;
                                <button type="button" (click)="equipmentSelectedOk()" class="btn btn-info btn-sm" title="确定">确定</button>
                                <dx-data-grid #ddg [dataSource]="equipemntItems" [hoverStateEnabled]="true" [paging]="{ enabled: true, pageSize: 1000 }"
                                    [filterRow]="{ visible: true }" [(selectedRowKeys)]="equipmentSelected" [scrolling]="{ mode: 'infinite' }"
                                    [height]="265" [showColumnLines]="true" [showRowLines]="true" [showBorders]="true" [rowAlternationEnabled]="true">
                                    <dxo-selection [selectAllMode]="allPages" [showCheckBoxesMode]="always" mode="multiple"></dxo-selection>
                                    <dxi-column dataField="stationCode" caption="工位" [width]="100">
                                    </dxi-column>
                                    <dxi-column dataField="subArea" caption="区域" [width]="100">
                                    </dxi-column>
                                </dx-data-grid>
                            </div>
                        </dx-drop-down-box>
                    </div>
                    <div class="form-group">
                        <label>模版</label>
                        <dx-select-box style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [items]="templateItems" displayExpr="templateName"
                            [(selectedItem)]="templateSel" [value]="templateItems[0]" [searchEnabled]="true">
                        </dx-select-box>
                    </div>
                    <div class="form-group">
                        <label>班次</label>
                        <dx-select-box #shift style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [items]="shiftItems" displayExpr="shiftName"
                            [(selectedItem)]="shiftSelected" [value]="shiftItems[0]" [searchEnabled]="true">
                        </dx-select-box>
                    </div>
                    <div class="form-group">
                        <label>查询类型</label>
                        <div>
                            <label *ngFor="let t of typeList">
                                <input type="radio" class="flat-red" (change)="type=t.id" name="type" [checked]="type===t.id">{{t.name}}
                            </label>
                        </div>
                    </div>
                </div>
                <div class="box-footer">
                    <button type="button" class="btn btn-primary" (click)="getReportData()"> 查 询 </button>
                </div>
            </div>
        </div>

        <div class="col-md-9 col-md-pull-3">
            <div class="box box-default" *ngIf="isShowCharts1">
                <div class="box-header with-border">
                    <h3 class="box-title">早班小时产量图表</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div echarts [options]="chartOption1" (chartInit)="onChartInit('早班小时产量图表',$event)" class="demo-chart" style="height:350px;"></div>
                </div>
            </div>
            <div class="box box-default" *ngIf="isShowCharts2">
                <div class="box-header with-border">
                    <h3 class="box-title">中班小时产量图表</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div echarts [options]="chartOption2" (chartInit)="onChartInit('中班小时产量图表',$event)" class="demo-chart" style="height:350px;"></div>
                </div>
            </div>
            <div class="box box-default" *ngIf="isShowCharts3">
                <div class="box-header with-border">
                    <h3 class="box-title">晚班小时产量图表</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div echarts [options]="chartOption3" (chartInit)="onChartInit('晚班小时产量图表',$event)" class="demo-chart" style="height:350px;"></div>
                </div>
            </div>
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">产能损失问题记录表</h3>
                    <div class="box-tools pull-right">
                        <div class="btn-group" style="margin-right:30px;">
                            <button type="button" [ngClass]="blockIndex ==0? 'btn btn-primary btn-sm':'btn btn-default btn-sm' " (click)="getBlockList('all')">
                                全部工位
                            </button>
                            <button type="button" [ngClass]="blockIndex ==1? 'btn btn-primary btn-sm':'btn btn-default btn-sm' " (click)="getBlockList('checked')">
                                选中工位
                            </button>
                        </div>
                        <button type="button" (click)="saveChanges()" class="btn btn-info btn-sm" data-toggle="tooltip" title="保存">
                            <i class="fa fa-save"></i>
                        </button>
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <dx-data-grid [dataSource]="blockList" [showColumnLines]="true" [showRowLines]="true" [showBorders]="true" 
                    [rowAlternationEnabled]="true" (onExporting)="onExporting($event)" [columnMinWidth]="50" [columnAutoWidth]="true">
                        <dxo-paging [pageSize]="10"></dxo-paging>
                        <dxo-editing mode="cell" [allowUpdating]="true"></dxo-editing>
                        <dxo-export [enabled]="true" fileName="产能损失分析" [allowExportSelectedData]="false"></dxo-export>
                        <dxo-pager [showPageSizeSelector]="true" [allowedPageSizes]="[10, 20, 100]" [showInfo]="true">
                        </dxo-pager>
                        <dxi-column [allowEditing]="false" dataField="subArea" caption="区域">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="station" caption="工位">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="shiftId" caption="班次">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="blockHourRange" caption="小时">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="blockStatus" caption="状态">
                        </dxi-column>
                        <dxi-column [allowEditing]="editEnable" dataField="faultStation" caption="故障工位">
                        </dxi-column>
                        <dxi-column [allowEditing]="editEnable" dataField="faultReason" caption="问题原因记录(生产填写)">
                        </dxi-column>
                        <dxi-column [allowEditing]="editEnable" dataField="wxFx" caption="维修分析">
                        </dxi-column>
                        <dxi-column [allowEditing]="editEnable" dataField="zlFx" caption="影响类型">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="duration" caption="损失时间(分)">
                        </dxi-column>
                        <dxi-column [allowEditing]="false" dataField="blockTimeBreakRange" caption="本次故障发生时间段">
                        </dxi-column>
                    </dx-data-grid>
                </div>
            </div>
            <!-- *ngFor="let i of list" -->
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">{{title}}查询</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <dx-data-grid [dataSource]="allRows" [showColumnLines]="true" [showRowLines]="true" [showBorders]="true" 
                    [rowAlternationEnabled]="true" (onExporting)="onExporting($event)" [columnMinWidth]="50" [columnAutoWidth]="true">
                        <dxo-paging [pageSize]="20"></dxo-paging>
                        <dxo-export [enabled]="true" fileName="产量OEE查询" [allowExportSelectedData]="false"></dxo-export>
                        <dxo-pager [showPageSizeSelector]="true" [allowedPageSizes]="[10, 20, 100]" [showInfo]="true">
                        </dxo-pager>
                        <dxi-column dataField="c1" caption="产量OEE分析">
                        </dxi-column>
                        <dxi-column dataField="c2" caption="">
                        </dxi-column>
                        <dxi-column dataField="c3" caption="">
                        </dxi-column>
                        <dxi-column dataField="c4" caption="">
                        </dxi-column>
                        <dxi-column dataField="c5" caption="">
                        </dxi-column>
                        <dxi-column dataField="c6" caption="">
                        </dxi-column>
                        <dxi-column dataField="c7" caption="">
                        </dxi-column>
                        <dxi-column dataField="c8" caption="">
                        </dxi-column>
                        <dxi-column dataField="c9" caption="">
                        </dxi-column>
                        <dxi-column dataField="c10" caption="">
                        </dxi-column>
                        <dxi-column dataField="c11" caption="">
                        </dxi-column>
                        <dxi-column dataField="c12" caption="">
                        </dxi-column>
                    </dx-data-grid>
                </div>
            </div>

        </div>

    </div>

</section>